Skip to content

Build non-trivial objects into the storage of the caller - #692

Merged
nunoplopes merged 10 commits into
Cpp2Rust:masterfrom
lucic71:build-in-caller-storage
Dec 2, 2026
Merged

nunoplopes merged 10 commits into
Cpp2Rust:masterfrom
lucic71:build-in-caller-storage

Conversation

@lucic71

@lucic71 lucic71 commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

For functions that return non-trivial objects, the caller passes the storage as the first argument of the function, the callee builds the returned object into that storage.

This models elidable construction.


Also fixed a bug where objects with implicit copy/move assignment were still try_unwrap'ed instead of built into the storage of the caller. Implicit move/copy special members get a memberwise derive.

Also implicit move calls copy constructor, not clone.

@lucic71
lucic71 marked this pull request as draft December 1, 2026 21:59
@lucic71
lucic71 marked this pull request as ready for review December 2, 2026 10:53
@nunoplopes
nunoplopes merged commit 582db3c into Cpp2Rust:master Dec 2, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants